package com.megurokai.paint;

import android.graphics.BitmapFactory;
import android.widget.ImageView;

public class SelectableIcon extends Icon{
	protected int idSelected;
	protected boolean enabled;
	
	public SelectableIcon(ImageView view, int id, int idSelected) {
		super(view, id);
		this.idSelected = idSelected;
		
		deselect();
	}
	
	public void setImage(SelectableIcon icon){
		this.id = icon.id;
		this.idSelected = icon.idSelected;
	}
	
	public void select(){
		enabled = true;
		view.setImageBitmap(BitmapFactory.decodeResource(view.getResources(), idSelected));
	}
	
	public void deselect(){
		enabled = false;
		view.setImageBitmap(BitmapFactory.decodeResource(view.getResources(), id));
	}
	
	public boolean isSelected(){
		return enabled;
	}
}
